-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the TinyMCE init array #10968
Fix the TinyMCE init array #10968
Conversation
- Added "manual" convert from php to js, same as in class-wp-editor.php. - Reformated the code so it's more readable.
'wptextpattern', | ||
'wpview', | ||
); | ||
$tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shouldn't we pass editor
if we want it to be as close as possible like the old editor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is (supposedly) the editor id and is intended to identify the TinyMCE instance when more than one on the same page. The classic editor passes content
there, but thinking it's no good to reuse that as the classic block editor instance is quite different and plugins should be able to identify it from php.
Passing editor
is a bit too generic :)
Is it not possible to compose the right PHP object, then JSON encode? |
No, because that breaks some of the functionality. The TinyMCE init is supposed to be written in (pure) js. It is in our (WordPress) implementation that we set it as php and then "convert" to js before output. Several settings in the init object accept js functions. If it is JSON encoded, that breaks. Example: Currently when using that plugin we get this in the console:
Happens because the init js is outputted by With this pr we get:
i.e. works as expected. |
Also, this pr adds another (custom) option to the TinyMCE init object: |
Heh? Tests failing because... the code is more readable? :)
This seems contrary to the WP coding standards. So when defining arrays they should look like:
The spacing looks so "borked" :) How is that easy to read? :) Opened WordPress/WordPress-Coding-Standards#1513 as follow up. |
Note: this doesn't quite yet solve #11147 (comment) |
Also opened https://core.trac.wordpress.org/ticket/45221 for core. This is a regression and a blocker for WP 5.0. |
Fixed in core https://core.trac.wordpress.org/changeset/43867. The fix needs to be merged here too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
These changes are already in Core, so no need to backport. |
Ughhh, PHPCS forcing ugly code formatting :( |
…rnmobile/wire-on-replace-para-block * 'master' of https://github.com/WordPress/gutenberg: Remove "permalink settings" link from permalink panel. (#12121) preserve quote content (#12122) Replace gutenberg domain with default for Core blocks (#12108) Fix issue with disabled togglecontrol double border (#12091) Fix the TinyMCE init array (#10968)
closes #10966, #11147, #7942, #8670